#if !defined(ximera_xml_xmldocument_hpp)
#define ximera_xml_xmldocument_hpp

// -----------------------------------------------------------

#include <ximera/xml/xmlnode.hpp>
#include <ximera/xml/xmlelement.hpp>

class TiXmlNode;
class TiXmlDocument;

namespace ximera { namespace xml
{
    class XmlElement;

    XIMERA_DECLARE_EXCEPTION_SUB(XmlParserException, XmlException, L"Error parsing XML");

    class XIMERA_API XmlDocument : public XmlNode
    {
    public:
        virtual XmlNodeType type() const { return XmlNodeType::Document; }

        void load(String const& fileName);
        void loadXml(String const& xmlStr);

        XmlElement* rootElement() const;

    private:
        void load(TiXmlDocument& tiDoc);
        void load(XmlNode* parent, TiXmlNode& tiNode);
    };
}}

// -----------------------------------------------------------

#endif